import { get } from '@/http/axios.js'
const actions = {
  getUserInfo(context){
    let token =localStorage.getItem('token')
    get('/user/info',{token:token}).then(res=>{
      context.commit('SET_USERINFO',res.data.data)
      localStorage.setItem('userId',res.data.data.id)
    })
  },
}
const mutations = {
  SET_USERINFO(state, response) {
    state.userInfo = response
  },
}
const state = {
  userInfo:{},
}

export default {
  namespaced: true,
  state,
  actions,
  mutations,
}